package com.osce.go_score.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.csce.domain.entity.go_score.GoScoreExamStudent;
import com.doudou.core.container.ListUtil;
import com.osce.go_score.mapper.GoScoreExamStudentMapper;
import com.osce.interfaces.go_score.IGoScoreExamStudentService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 妇产科考试考场-学生Service业务层处理
 *
 * @author ruoyi
 * @since 2024-05-17
 */
@Service
public class GoScoreExamStudentServiceImpl extends ServiceImpl<GoScoreExamStudentMapper, GoScoreExamStudent> implements IGoScoreExamStudentService {


    /**
     * 查询妇产科考试考场-学生
     *
     * @param id 妇产科考试考场-学生主键
     * @return 妇产科考试考场-学生
     */
    @Override
    public GoScoreExamStudent selectGoScoreExamStudentById(Long id) {
        return baseMapper.selectGoScoreExamStudentById(id);
    }

    /**
     * 查询妇产科考试考场-学生列表
     *
     * @param goScoreExamStudent 妇产科考试考场-学生
     * @return 妇产科考试考场-学生
     */
    @Override
    public List<GoScoreExamStudent> selectGoScoreExamStudentList(GoScoreExamStudent goScoreExamStudent) {
        return baseMapper.selectGoScoreExamStudentList(goScoreExamStudent);
    }

    @Override
    public List<GoScoreExamStudent> selectGoScoreExamStudentByExamId(Long examId) {
        return baseMapper.selectGoScoreExamStudentByExamId(examId);
    }

    /**
     * 新增妇产科考试考场-学生
     *
     * @param goScoreExamStudent 妇产科考试考场-学生
     * @return 结果
     */
    @Override
    public int insertGoScoreExamStudent(GoScoreExamStudent goScoreExamStudent) {
        return baseMapper.insertGoScoreExamStudent(goScoreExamStudent);
    }

    /**
     * 修改妇产科考试考场-学生
     *
     * @param goScoreExamStudent 妇产科考试考场-学生
     * @return 结果
     */
    @Override
    public int updateGoScoreExamStudent(GoScoreExamStudent goScoreExamStudent) {
        return baseMapper.updateGoScoreExamStudent(goScoreExamStudent);
    }

    /**
     * 批量删除妇产科考试考场-学生
     *
     * @param ids 需要删除的妇产科考试考场-学生主键
     * @return 结果
     */
    @Override
    public int deleteGoScoreExamStudentByIds(Long[] ids) {
        return baseMapper.deleteGoScoreExamStudentByIds(ids);
    }

    /**
     * 删除妇产科考试考场-学生信息
     *
     * @param id 妇产科考试考场-学生主键
     * @return 结果
     */
    @Override
    public int deleteGoScoreExamStudentById(Long id) {
        return baseMapper.deleteGoScoreExamStudentById(id);
    }

    @Override
    public int deleteGoScoreExamStudentByExamPlaceIds(Long[] ids) {
        return baseMapper.deleteGoScoreExamStudentByExamPlaceIds(ids);
    }

    @Override
    public int deleteGoScoreExamStudentByExamPlaceId(Long id) {
        return baseMapper.deleteGoScoreExamStudentByExamPlaceId(id);
    }

    @Override
    public int deleteGoScoreExamStudentByExamIds(Long[] ids) {
        return baseMapper.deleteGoScoreExamStudentByExamIds(ids);
    }

    @Override
    public int deleteGoScoreExamStudentByExamId(Long id) {
        return baseMapper.deleteGoScoreExamStudentByExamId(id);
    }

    @Override
    public int batchInsertGoScoreExamStudent(Long examId, Long examPlaceId, List<GoScoreExamStudent> goScoreExamStudentList) {
        if (ListUtil.isNotEmpty(goScoreExamStudentList)){
            goScoreExamStudentList = goScoreExamStudentList.stream().peek(o->{
                o.setExamId(examId);
                o.setExamPlaceId(examPlaceId);
            }).collect(Collectors.toList());
        }
        return baseMapper.batchInsertGoScoreExamStudent(goScoreExamStudentList);
    }

}
